package cn.antia.cep.test;

import java.text.SimpleDateFormat;
import java.util.*;

import cn.antia.cep.db.hibernate.bean.*;

public class Comp implements Comparator{
	private String name;
	private Integer index;
	private Boolean bool;
	
	/**
	 * @return the bool
	 */
	public Boolean getBool() {
		return bool;
	}
	/**
	 * @param bool the bool to set
	 */
	public void setBool(Boolean bool) {
		this.bool = bool;
	}
	/**
	 * @return the index
	 */
	public Integer getIndex() {
		return index;
	}
	/**
	 * @param index the index to set
	 */
	public void setIndex(Integer index) {
		this.index = index;
	}
	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}
	/**
	 * @param name the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}
	/* (non-Javadoc)
	 * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
	 */
	public int compare(Object com1, Object com2) {
		Comp com11 = (Comp)com1;
		Comp com22 = (Comp)com2;
		if(com11.getIndex().intValue() > com22.getIndex().intValue()){
			return 1;
		}else if(com11.getIndex().intValue() < com22.getIndex().intValue()){
			return -1;
		}
		return 0;
	}
	public static void main(String[] args){
		String sdiff = "test\\test";
		System.out.println(sdiff);
		sdiff = sdiff.replace('\\', ' ');
		sdiff = sdiff.replaceAll(" ", "");
		System.out.println(sdiff);
		//System.out.println(sdiff.equals(s));
		//System.out.println(s.equals(sdiff));
	}
/*
	public static void main(String[] args){
		System.out.println("asssssssssssssssssssss");
		Comp com1 = new Comp();
		com1.setIndex(new Integer(2));
		Comp com2 = new Comp();
		com2.setIndex(new Integer(3));
		Comp com3 = new Comp();
		com3.setIndex(new Integer(1));
		List list = new LinkedList();
		list.add(com1);
		list.add(com2);
		list.add(com3);
		Object[] coms = list.toArray();
		Arrays.sort(coms,com1);
		list = new LinkedList();
		for(int i = 0;i<coms.length;i++){
			list.add(coms[i]);
		}
		Collections.sort(list, new Comp());
		for(int i = 0;i<list.size();i++){
			Comp com = (Comp)list.get(i);
			System.out.println(com.getIndex());
		}
		//Arrays.sort(arg0, arg1)
		int i = com1.compare(com1, com2);
		if(i > 0){
			System.out.println("com1 > com2");
		}else if(i < 0){
			System.out.println("com1 < com2");
		}else{
			System.out.println("equals");
		}
	}*/
	
	/*
	public static void main(String[] args) 
	{
	java.util.Calendar c=java.util.Calendar.getInstance();
	java.text.DateFormat df=new java.text.SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
	System.out.println("当前时间: "+df.format(c.getTime()));
	c.set(java.util.Calendar.DAY_OF_WEEK, java.util.Calendar.SATURDAY);
	System.out.println("最近周六时间: "+df.format(c.getTime()));
	}*/
	/*
	public static void main(String[] args){
		Date logintime = new Date(2007,3,19,0,10,10);
		Calendar cs = Calendar.getInstance(Locale.ENGLISH);
		cs.setTime(logintime);
		//活动时间
		long active = Calendar.getInstance().getTimeInMillis() - cs.getTimeInMillis();
		System.out.println(Calendar.getInstance(Locale.CHINESE).getTimeInMillis());
		System.out.println(cs.getTimeInMillis());
		System.out.println(active);
		cs.setTimeInMillis(active);
		
		String activeDesc = cs.get(Calendar.HOUR) - 8 + " 小时 " + cs.get(Calendar.MINUTE) + " 分　" + cs.get(Calendar.SECOND) + "秒";
		System.out.println(activeDesc);
	}*/
	
}
